package com.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mapper.HouseMapper;
import com.pojo.House;
import com.service.HouseService;
import com.vo.HouseVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class HouseServiceimpl implements HouseService {
    @Resource
    private HouseMapper houseMapper;
    @Override
    public  PageInfo<House> selectHouseall(HouseVo houseVo) {
        PageHelper.startPage(houseVo.getPage(),houseVo.getLimit());
        List<House> houses = houseMapper.selectHouseall(houseVo);
        PageInfo<House> pageInfo=new PageInfo<>(houses);
        return pageInfo;
    }

    @Override
    public int selectcountbyfloorid(int id) {
        int selectcountbyfloorid = houseMapper.selectcountbyfloorid(id);
        return selectcountbyfloorid;
    }

    @Override
    public List<House> selectzuByHouse(HouseVo houseVo) {
        List<House> houses = houseMapper.selectzuByHouse(houseVo);
        return houses;
    }

    @Override
    public House selecthouseByid(Integer id) {
        House house = houseMapper.selecthouseByid(id);
        return house;
    }

    @Override
    public int updatestateByid(Integer state, Integer id,Integer ownerid) {
        int i = houseMapper.updatestateByid(state, id,ownerid);
        return i;
    }

    @Override
    public int updateByPrimaryKeySelective(House record) {
        int i = houseMapper.updateByPrimaryKeySelective(record);
        return i;
    }

    @Override
    public int selecthouseByownerid(Integer id) {
        int i = houseMapper.selecthouseByownerid(id);
        return i;
    }

    @Override
    public int updatestateByids(Integer state, Integer id) {
        int i = houseMapper.updatestateByids(state, id);
        return i;
    }

    @Override
    public int selecttotalhouse(Integer plotid) {
        int selecttotalhouse = houseMapper.selecttotalhouse(plotid);
        return selecttotalhouse;
    }

    @Override
    public int selecttotalzuanzu(Integer plotid) {
        int selecttotalzuanzu = houseMapper.selecttotalzuanzu(plotid);
        return selecttotalzuanzu;
    }

}
